The present invention relates to compilers and programming languages. A compiler is generally used to translate a high-level programming language to a machine language that more closely matches the instruction set used to execute on a target processor. During this conversion or translation process, the compiler analyzes the source code being compiled in a front-end portion and then uses a backend portion to synthesize the results produced from the front-end into an object with executable instructions. Many times the compiler is able to produce code faster and more efficiently than would be possible hand-coding.
In addition, the compiler may also include various optional codes along with the source code being compiled. These optional codes including debug codes to detect runtime errors, tracing and logging codes to capture information, and other more speculative runtime optimization codes that could be used to potentially improves overall performance at runtime. During debugging of an application, these executables with the optional codes are useful as they provide information, warnings, and clues on areas of the code that may be problematic. For example, debug codes that check pointer and array boundaries are important as they either prevent or detect serious errors that could result in data corruption or otherwise undetected errors.
Unfortunately, adding any or all of these types of optional codes to the compiled source code tends to increase the computational requirements for processing the executable object and may slow down the execution significantly. Typically, the execution overhead associated with adding these optional codes using conventional compilers is proportional to the number of optional codes added. This overhead for processing the optional instructions is typically not acceptable to users and end users. Consequently, production compilations of the source code are recompiled and stripped of any and all optional codes to increase performance. End users enjoy the increased performance but risk suffering corrupted data, experiencing the effects of undetected errors during runtime and are limited with information to assist in the debugging or analysis process.
In general, current compilers do not deal with optional instructions in an acceptable manner. While the optional instructions provide important information to both end-users and developers, there remains no method of including the optional instructions without impacting performance. Developers need to maintain and sometimes distribute two versions of software or two codebases: one executable is compiled to include all the optional instructions while another executable is stripped of all option instructions and all the ancillary information described. This makes maintaining the codebase for a software product that much more complex as two executables need to be maintained instead of one.
Like reference numbers and designations in the various drawings indicate like elements.